<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

    <title>GM管理平台</title>
   <!--  <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术"> -->
    <link href="/lender/css/bootstrap.min.css" rel="stylesheet">
    <link href="/lender/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/lender/css/style.min.css" rel="stylesheet">
    <link href="/lender/css/login.min.css" rel="stylesheet">
    <script type="text/javascript" src="/lender/js/jquery.min.js"></script>
    <script type="text/javascript" src="/lender/js/bootstrap.min.js"></script>
 	<script type="text/javascript" src=" /lender/layer/layer.js"></script>
 	<script type="text/javascript" src=" /lender/js/MD5/md5.js"></script>
   	<style type="text/css">
   			#loadAgin{
   				cursor: pointer;
   			}
   			#login_form{
   				background: rgba(255, 255, 255, .2);
			    border: 1px solid rgba(255, 255, 255, .3);
			    -moz-box-shadow: 0 3px 0 rgba(12, 12, 12, .03);
			    -webkit-box-shadow: 0 3px 0 rgba(12, 12, 12, .03);
			    box-shadow: 0 3px 0 rgba(12, 12, 12, .03);
			    -moz-border-radius: 3px;
			    -webkit-border-radius: 3px;
			    border-radius: 3px;
			    padding: 30px;
   			}
   	</style>
    <script>
         if (window.top !== window.self) {
            window.top.location = window.location
        }; 
        function reloadImg(){
        	var url = '/lender/login/getOutCode.do?n='+Math.random();
    		$('#loadAgin').attr('src',url); 
        }
        
    </script>
</head>

<body class="signin" >
 <div class="signinpanel">
    <div class="row">
        <div class="col-sm-7">
            <div class="signin-info">
                <div class="logopanel m-b">
                    <h1>GM</h1>
                </div>
                <div class="m-b"></div>
                <h4>欢迎使用 <strong>GM平台</strong></h4>
                <ul class="m-b">
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 高效</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 迅捷</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 准确</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 大容量</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 更全面</li>
                </ul>
            </div>
        </div>
        <div class="col-sm-5">
            <div id="login_form">
                <h4 class="no-margins" >登录：</h4>
                <input type="text" class="form-control uname" placeholder="用户名" id="uname"/>
                <input type="password" class="form-control pword m-b" placeholder="密码" id="password"/>
               	<input type="text" id="code_yzm" style="height: 34px;width: 50%;color:black;" placeholder="验证码"/>&nbsp;<img src="/lender/login/getOutCode.do"  onclick="reloadImg()" id="loadAgin">
                <button class="btn btn-success btn-block" id="jp_page">登录</button>
            </div>
        </div>
    </div>
    <div class="signup-footer">
        <div class="pull-left">
            &copy; 2018 GM版权
        </div>
    </div>
</div> 
</body>
<script type="text/javascript">
document.onkeydown = function (event) {
    var e = event || window.event;
    if (e && e.keyCode == 13) { //回车键的键值为13
    	loginCheck();
    }
}; 

$(function(){
	
	$('#jp_page').click(function(){
		loginCheck();
	    /*  window.location.href='/lender/login/manangerPage.html'; */
	});
	
});
function gm(){};
gm.ajax=function(s){
    jQuery.ajax(s);
}

function loginCheck(){
	var userName = $('#uname').val();
	var password = $('#password').val();
	var code =  $('#code_yzm').val();
	if(userName==""||userName==undefined){
		alert("用户名不能为空!");
		return;
	}
	if(password==""||password==undefined){
		alert("密码不能为空!");
		return;
	}else{
		password= hex_md5(password);
	}
	if(code==""||code==undefined){
		alert("验证码不能为空!");
		return;
	}
	gm.ajax({
		url:'/lender/userController/checkToLogin.do?n='+Math.random(),
		type:'get',
		data:{userName:userName,pwd:password,code:code},
		dataType:'json',
		success:function(data){
			if(data.code == '000'){
				window.location.href = data.linkUrl+'?n='+Math.random();
			}else if(data.code == '001'){
				alert(data.msg);
			}else if(data.code == '002'){
				alert(data.msg);
			}else{
				alert(data.msg);
			}
		},
		error:function(){
			
		}
	});	
}
</script>
</html>

